<template>
  <div class='search'>
    <a-descriptions bordered size='small' :column='3'>
      <a-descriptions-item label='单据日期'>
        {{ formItem.orderDate }}
      </a-descriptions-item>
      <a-descriptions-item label='订单编号'>
        {{ formItem.orderNo }}
      </a-descriptions-item>
      <a-descriptions-item label='单位编码'>
        {{ formItem.companyCode }}
      </a-descriptions-item>
      <a-descriptions-item label='业务员'>
        {{ formItem.employeeName }}
      </a-descriptions-item>
      <a-descriptions-item label='区域'>
        {{ formItem.deptName }}
      </a-descriptions-item>
    </a-descriptions>
    <a-divider orientation='left'>订单商品</a-divider>
    <a-table :columns="orderDetailsColumns" size='small' :scroll='{x:800}'  :data-source="orderDetailsList" :bordered="true" :pagination="false">
    </a-table>
  </div>
</template>
<script>
  import api from './js/api'

  export default {
    name: 'orderInfo',
    props: {},
    data() {
      return {
        refs: this.$refs,
        loadDept: false,
        queryParam: { orderId: '' },
        api: Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        orderDetailsId: null,
        processImageVisible: false,
        orderDetailsColumns: [
         {
            title: '商品名称',
            align: 'center',
            width: '150px',
            ellipsis: true,
            dataIndex: 'drugsName'
          }, {
            title: '商品规格',
            align: 'center',
            width: '180px',
            ellipsis: true,
            dataIndex: 'drugsSpec'
          }, {
            title: '件容',
            align: 'center',
            width: '80px',
            dataIndex: 'drugJr'
          }, {
            title: '批号',
            align: 'center',
            width: '80px',
            dataIndex: 'drugLotNo'
          }, {
            title: '含税价格',
            width: '80px',
            align: 'center',
            dataIndex: 'salePrice'
          }, {
            title: '数量',
            align: 'center',
            width: '80px',
            dataIndex: 'saleAmount'
          }, {
            title: '销售金额',
            align: 'center',
            width: '80px',
            dataIndex: 'saleAmount'
          }
        ],
        formItem: this.getFormItem(),
        supplierBond: {},
        orderDetailsList: []
      }
    },
    methods: {
      getFormItem() {
        return {
          orderNo: ''
        }
      },
      getOrderDetailList(orderNo) {
        let params = { 'orderNo': orderNo }
        this.http.get(this, {
          url: this.api.hyOrderDetailOut.queryHyOrderDetailList,
          params: params,
          success: function(me, data) {
            console.info(data)
            me.orderDetailsList = data
          }
        })
      },
      //表单赋值
      setData(record) {
        console.info(record)
        this.formItem = this.getFormItem()
        this.queryParam.orderId = record.orderId
        if (record && record.orderNo) {
          let params = {
            orderNo: record.orderNo
          }
          this.http.get(this, {
            url: this.api.hyOrderOut.get,
            params: params,
            success: function(me, data) {
              console.info(data)
              me.formItem = data
              me.loaded = true
            }
          })
          this.getOrderDetailList(record.orderNo)
        }
      }
    },
    mounted() {
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang='less' rel='stylesheet/less'>

</style>
